package Controllers

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"websocket_callback/Services"
)
// 回调处理
func WebNotify(ctx *gin.Context){
	var notify Services.Notify

	err := ctx.ShouldBind(&notify)
	if err != nil {
		ctx.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
		return
	}
	data, err := notify.WebInsert()
	if err != nil {
		ctx.JSON(http.StatusOK, gin.H{
			"code":    -1,
			"message": err.Error(),
			"data": struct {
			}{},
		})
		return
	}
	ctx.JSON(http.StatusOK, gin.H{
		"code":    1,
		"message": "success",
		"data": data,
	})
	return
}